package atguigu.gson;

import com.google.gson.Gson;

import java.util.List;

public class Demo2 {
    public static void main(String[] args) {
        String str = "{\"studentList\":[{\"code\":\"01\",\"name\":\"张三\",\"description\":\"武汉\"},{\"code\":\"02\",\"name\":\"李四\",\"description\":\"北京\"}]}";
        Gson gson = new Gson();
        Student student = gson.fromJson(str, Student.class);
        if(student != null){
            List<Student.StudentInfo> studentList = student.getStudentList();
            studentList.stream().forEach(e->{
                System.out.println(e.getDescription());
                System.out.println(e.getName());
            });
        }

    }
}
